import { Component, OnInit } from '@angular/core';
import {Router, ActivatedRoute} from '@angular/router';
@Component({
  selector: 'app-news',
  templateUrl: './news.component.html',
  styleUrls: ['./news.component.less']
})
export class NewsComponent implements OnInit {
  private newsId: string;
  constructor(private router: Router, private routerinfo: ActivatedRoute) { }

  ngOnInit() {
    this.newsId = this.routerinfo.snapshot.params['id'];
    console.log(this.newsId, 'this.routerinfo.snapshot.params');
  }
  tab() {
    // this.router.navigateByUrl('/');
    this.router.navigate(['/'],{queryParams: {name: '李强'}});
  }
}
